<div class="container">
<?php echo $this->render('left.phtml'); ?>
    <div class="main-container">
        <div class="title-main-container">
            <span style="text-transform: uppercase;">Tìm kiếm sản phẩm</span>
        </div>
        
        <?php
            if(count($this->data) > 0) :
            $common = new Admincp_Model_Common();
        ?>
        <p style="margin-bottom: 0;">Tìm thấy <?php echo $this->total; ?> kết quả với từ <span class="error-msg"><?php echo $this->keyword; ?></span></p>
        <?php
            foreach($this->data as $value) :
            switch($value['type']) {
                case    1   :   $name = 'fashion'; break;
                case    2   :   $name = 'baby'; break;
                case    3   :   $name = 'furniture'; break;
            }
        ?>
        <div class="product-content">
            <div class="product-images">
                <img src="<?php echo $this->baseUrl('/public/files/'.$name.'/thumbnail/').$value['thumbnail']; ?>" width="228" height="256"/>
                <p class="hover">
                    <a href="<?php echo $this->url(array('action'=>'detail','controller'=>$name,'module'=>'default','title'=>$value['url'],'id'=>$value['id']),$name.'detail'); ?>"></a>
                </p> 
                <a class="button-hover" href="<?php echo $this->url(array('action'=>'detail','controller'=>$name,'module'=>'default','title'=>$value['url'],'id'=>$value['id']),$name.'detail'); ?>">XEM NGAY</a>
                <?php if($common->dateDiff(date('Y-m-d'), $value['create_date']) <= 3) : ?>
                <span class="title-new">NEW</span>
                <?php endif; ?>
            </div>   
            <div class="product-info">
                <span><?php echo $value['name']; ?></span>
                <?php if($value['sale_price'] != '0') : ?>
                <span class="price"><?php echo $common->formatMoney($value['sale_price']); ?>đ</span>
                <span class="sale_price"><?php echo $common->formatMoney($value['price']); ?>đ</span>
                <?php else : ?>
                <span class="price"><?php echo $common->formatMoney($value['price']); ?>đ</span>
                <?php endif; ?>
            </div>    
        </div>
        <?php endforeach; ?>
    
        <div class="pagination">
        <?php
            $currentUrl = '&text-search='.$this->keyword.'&search-button=';
            echo $this->paginationControl($this->data, 'Sliding', 'index/pagination.phtml', array('currentUrl' => $currentUrl));
        ?>
        </div>
        <?php else : ?>
        <p>Không tìm thấy sản phẩm nào</p>
        <?php endif; ?>
    </div>
</div>